package EnrynHsu.affiliate;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import static EnrynHsu.affiliate.HighEngine.*;

/**
 * Hello world!
 *
 */
public class App 
{
    public static void main( String[] args ) throws ExpressParseException {
////        for (int i[] : new int[2][2])
//        final ArrayList<Integer> arrayList = new ArrayList<>();
//        arrayList.add(1);
//        System.out.println(arrayList.get(0));
//        System.out.println(Double.parseDouble("123213"));
//        System.out.println(Integer.parseInt("1212"));
//        arrayList.remove(0);
//        arrayList.add(0,2);
//        System.out.println(arrayList);
//
//        Number a = 1.2;
////        System.out.println(new Float(12.12) instanceof Double);
//        System.out.println(a.getClass());
//        System.out.println((double) new Integer(12));
//        System.out.println(1.0/0.0);
//        System.out.println(Integer.MAX_VALUE);
//        Resolver.main(new String[]{"12^2"});

//        System.out.println((Math.log(1)/Math.log(1)) * (Math.pow(1212,1212)));
//        System.out.println(Math.pow(1212,1212));

//        int num1 = 0;
//        int num2 = 1;
//        switch (num1){
//            case 0:
//                switch (num2) {
//                    case 0:
//                    case 1:
//                }
//            case 1:
//                switch (num2) {
//                    case 0:
//                    case 1:
//                }
//            default: throw new ExpressParseError("取余不能的操作数必须是整数");
//        }

        Resolver.engine = Resolver.highEngine;
//        System.out.println(HighEngine.minus("1.090","0.12"));
//        final Matcher matcher = Pattern.compile("^(0+)?(?<res>\\d+\\.\\d+?)(0+)?$").matcher("0.970");
//        matcher.find();
//
//        System.out.println(matcher.group("res"));
//        HighEngine.compare("123124","1423123");
//        Resolver.engine = (a,b,c) -> "1.2132";
//        System.out.println(Resolver.resolve("123.085*12"));
//        System.out.println(HighEngine.divide("1","5"));
//        System.out.println(HighEngine.compare("0.123213","123"));
//        System.out.println(HighEngine.trim_zero("123"));

//        System.out.println(HighEngine.multiply("1.34234","5"));
//        System.out.println(HighEngine.raw_minus("0123213", "0002113"));
//        System.out.println(Arrays.toString(raw_divide("0", "125")));
//        System.out.println(HighEngine.toBinary_resolver("-23324"));
//        System.out.println(HighEngine.toDecimal("1101010111010"));
//        System.out.println(HighEngine.toDecimal_resolver("-11111101"));
//        System.out.println(HighEngine.trim_zero("0"));
//        System.out.println(HighEngine.divide("1", HighEngine._extractionOfRoot("12", HighEngine.trim_neg("-0.2")), 0, 10));
//        System.out.println(HighEngine.divide_resolver("1","1.6437518295172257623084979362309795173834925899454752004110297675321076924920997929976201984189477429",10));
//        System.out.println(-11&1);
//        System.out.println(HighEngine._extractionOfRoot("0.2","5"));
//        System.out.println(HighEngine.power_resolver("213.23","1.2"));
//        System.out.println(HighEngine.power_resolver("2","0.41"));
//        System.out.println(HighEngine.divide_resolver("7","845.155",10));
//        System.out.println("n1".split("\\.")[1].length());
//        System.out.println(log("0.81","2"));
//        System.out.println(Arrays.toString(HighEngine.commonFactor_simplify("333783", "45")));
//        System.out.println(Arrays.toString(toFraction("0.741721")));
//        System.out.println(compare("0.2738","1"));
//        System.out.println(HighEngine.divide("61","103", 0,1));
//        System.out.println(HighEngine.divide_resolver("61", "103", 1));
//        System.out.println(HighEngine.compare("1.23","43"));
        System.out.println(Resolver.resolve("123212214444444/2121213213"));


//        for (var i :
//                List.of("1","2", "3", "5", "7", "11", "13", "17", "19", "23", "29", "31", "37", "41", "43", "47", "53", "59", "61", "67", "71", "73", "79", "83", "89", "97", "101", "103", "107", "109", "113", "127", "131", "137", "139", "149", "151", "157", "163", "167", "173", "179", "181", "191", "193", "197", "199", "211", "223", "227", "229", "233", "239", "241", "251", "257", "263", "269", "271", "277", "281", "283", "293", "307", "311", "313", "317", "331", "337", "347", "349", "353", "359", "367", "373", "379", "383", "389", "397", "401", "409", "419", "421", "431", "433", "439", "443", "449", "457", "461", "463", "467", "479", "487", "491")) {
//
//            for (var k :
//                    List.of("2", "3", "5", "7", "11", "13", "17", "19", "23", "29", "31", "37", "41", "43", "47", "53", "59", "61", "67", "71", "73", "79", "83", "89", "97", "101", "103", "107", "109", "113", "127", "131", "137", "139", "149", "151", "157", "163", "167", "173", "179", "181", "191", "193", "197", "199", "211", "223", "227", "229", "233", "239", "241", "251", "257", "263", "269", "271", "277", "281", "283", "293", "307", "311", "313", "317", "331", "337", "347", "349", "353", "359", "367", "373", "379", "383", "389", "397", "401", "409", "419", "421", "431", "433", "439", "443", "449", "457", "461", "463", "467", "479", "487", "491", "499")) {
//
//                if (i.equals(k)) continue;
//                if (compare(i,k).comp()==1) continue;
//
//                String s = divide_resolver(i, k, 250);
//
//                System.out.println("map.put(\"" + i + "/" + k +"\","+"\""+s+"\");");
//
//            }
//
//        }



//        // 保存现场
//        String n2 = "1";//分母
//
//        // 找出较大临界值
//        for (int n = 0; n < 155; n++){
//            String n1 = "1";// 分子
//            for (int m = 0; m < 155; m++) {
//
//                // 保存现场
//                String num1 = n1, num2 = n2;
//
//                // 化简分数
//                String[] simp = commonFactor_simplify(num1, num2);
//                num1 = simp[0];
//                num2 = simp[1];
//
//                // 如果可以化简，那么说明，计算结果已经存在，那么开始下一轮循环
//                if (!num2.equals(n2)) continue;
//
//
//                if (compare(num1,num2).comp()==1) continue;
//
//                // 得出分数结果
//                String s = divide_resolver(num1, num2, 250);
//                System.out.println("map.put(\"" + num1 + "/" + num2+"\","+"\""+s+"\");");
//
//                n1 = add(n1,"1");
//
//            }
//            n2 = add(n2,"1");
//        }

//        for (var i :
//                container.entrySet()) {
//            System.out.println("\"" + i.getKey()+"\","+"\""+i.getValue()+"\",");
//        }

    }


}
